--use QLRAPPHIM
begin tran lostupdate_error

declare @tinhtrang int
select @tinhtrang = TinhTrangVe from Ve 
where MaVe = 'V4'
waitfor  DELAY '00:00:10'
if @tinhtrang = 0 
begin

update Ve set TinhTrangVe = 1,NguoiLon_TreEm = 'true' ,HoTenKH = 'Vo Thanh Tuan',SDT = '01688306571',CMND = '215154564',ThoiGianDatVe = '1/1/2012' where MaVe = 'V4'
 print 'Ban da dat ve thanh cong!'
END
else
  print 'Dat ve khong thanh cong. Boi Vi Ve da co nguoi dat roi!'


commit tran lostupdate_error

